/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package classe.entidade;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author Kellison
 */
@Entity
@Table(name = "tbl_requisicao_material")
@NamedQueries({
    @NamedQuery(name = "RequisicaoMaterial.findAll", query = "SELECT r FROM RequisicaoMaterial r")})
public class RequisicaoMaterial implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    private Integer id;
    @Basic(optional = false)
    @Column(name = "data")
    @Temporal(TemporalType.DATE)
    private Date data;
    @Basic(optional = false)
    @Column(name = "tipo_consumo")
    private String tipoConsumo;
    @Basic(optional = false)
    @Column(name = "situacao")
    private String situacao;
    @OneToMany(mappedBy = "idRequisicao")
    private List<Estoque> estoqueList;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idTblRequisicaoMaterial")
    private List<RequisicaoItem> requisicaoItemList;
    @JoinColumn(name = "id_tbl_usuario", referencedColumnName = "id")
    @ManyToOne(optional = false)
    private Usuario idTblUsuario;

    public RequisicaoMaterial() {
    }

    public RequisicaoMaterial(Integer id) {
        this.id = id;
    }

    public RequisicaoMaterial(Integer id, Date data, String tipoConsumo, String situacao) {
        this.id = id;
        this.data = data;
        this.tipoConsumo = tipoConsumo;
        this.situacao = situacao;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Date getData() {
        return data;
    }

    public void setData(Date data) {
        this.data = data;
    }

    public String getTipoConsumo() {
        return tipoConsumo;
    }

    public void setTipoConsumo(String tipoConsumo) {
        this.tipoConsumo = tipoConsumo;
    }

    public String getSituacao() {
        return situacao;
    }

    public void setSituacao(String situacao) {
        this.situacao = situacao;
    }

    public List<Estoque> getEstoqueList() {
        return estoqueList;
    }

    public void setEstoqueList(List<Estoque> estoqueList) {
        this.estoqueList = estoqueList;
    }

    public List<RequisicaoItem> getRequisicaoItemList() {
        return requisicaoItemList;
    }

    public void setRequisicaoItemList(List<RequisicaoItem> requisicaoItemList) {
        this.requisicaoItemList = requisicaoItemList;
    }

    public Usuario getIdTblUsuario() {
        return idTblUsuario;
    }

    public void setIdTblUsuario(Usuario idTblUsuario) {
        this.idTblUsuario = idTblUsuario;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof RequisicaoMaterial)) {
            return false;
        }
        RequisicaoMaterial other = (RequisicaoMaterial) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "classe.RequisicaoMaterial[ id=" + id + " ]";
    }
    
}
